﻿using Dto;
using Model;
using System.Collections.Generic;

namespace Dlpad.Services
{
    public interface IDictDataService
    {
        /// <summary>
        /// 根据字段类型获取字典数据（包含缓存逻辑）
        /// </summary>
        Task<List<DictDataResponseDto>> GetDictDataByTypeAsync(string dictType);

        /// <summary>
        /// 获取字典选项（用于下拉框、单选框、复选框）
        /// </summary>
        Task<List<DictOptionDto>> GetDictOptionsAsync(string dictType);

        /// <summary>
        /// 获取多个字典类型的数据
        /// </summary>
        Task<Dictionary<string, List<DictOptionDto>>> GetMultipleDictOptions(List<string> dictTypes);

        /// <summary>
        /// 根据字典标签获取字典值
        /// </summary>
        Task<string?> GetDictValueByLabelAsync(string dictType, string dictLabel);

        /// <summary>
        /// 根据字典值获取字典标签
        /// </summary>
        Task<string?> GetDictLabelByValuesAsync(string dictType, string dictValue);

        // 字典数据 CRUD 方法
        Task<PagedResultDto<DictDataResponseDto>> GetDictDataListAsync(DictDataQueryDto query);
        Task<SysDictData?> GetDictDataByIdAsync(long id);
        Task<bool> CreateDictDataAsync(SysDictData dictData);
        Task<bool> UpdateDictDataAsync(SysDictData dictData);
        Task<bool> DeleteDictDataAsync(long id);

        // 清除缓存方法
        Task ClearDictDataCacheAsync(string dictType = null);
    }
}